package com.base.jdk8;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * jdk7 和JDK8关于集合排序的操作方式
 *
 * @author: May
 * @date 2020/5/13
 */
public class CollectionSortTest {
    public static void main(String[] args) {
        List<String> cities7 = initArrayListFor7();
        List<String> cities8 = initArrayListFor8();
        Collections.sort(cities7);
        System.out.println("cities7 = " + cities7);
    }

    private static List<String> initArrayListFor8() {
        return getList();
    }

    private static List<String> initArrayListFor7() {
        return getList();
    }

    private static List<String> getList() {
        List<String> cities = new ArrayList<>(5);
        cities.add("上海");
        cities.add("北京");
        cities.add("天津");
        cities.add("杭州");
        cities.add("洛阳");
        return cities;
    }

}
